package whathappens;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Vars {

    private static String Version = "WhatHappens 0.0.0-4";

    public static String getVersion() {
        return Vars.Version;
    }
    // Properties
    /*
     * Username
     * Userpass
     * DB_URL
     */
    public static Properties prop = new Properties();
    public static String PropFileName = "";
    public static String PropPath = "";

    public static void SaveProperties() {
        try {
            prop.storeToXML(new FileOutputStream(PropFileName, false), null);
        } catch (IOException ex) {
            Logger.getLogger(Vars.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void LoadProperties() {
        try {
            Vars.prop.loadFromXML(new FileInputStream(PropFileName));
        } catch (IOException ex) {
            Logger.getLogger(Vars.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    // Plugins
    private static ArrayList<WhathappensPlugin> Plugins = new ArrayList<WhathappensPlugin>();

    public static ArrayList<WhathappensPlugin> getPlugins() {
        return Vars.Plugins;
    }

    public static void LoadPlugins() {
        Vars.Plugins.clear();

        WhathappensPlugin plugin;
        plugin = new PluginTest();

        Vars.Plugins.add(plugin);
    }
}
